using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MissZone : MonoBehaviour
{
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Ball ball = collision.gameObject.GetComponent<Ball>();
        Prop prop = collision.gameObject.GetComponent<Prop>();

        if (ball != null)
        {
            //如果是最后一个球掉地上则减生命值，否则销毁
            if (GameManager.Instance.IsLastBall())
            {
                GameManager.Instance.Miss();
            }
            else
            {
                Destroy(ball.gameObject);
            }

        }
        
        //销毁道具
        if (prop != null)
        {
            Destroy(prop.gameObject);
        }
    }
}
